package metier.sess;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import metier.entities.GLN;


@Stateless(name="GLN")
public class GLNEJBImpl implements IGLNLocal{
	@PersistenceContext(unitName="PU_Cargaison")
	private EntityManager em;

	@Override
	public void addGLN(GLN gln) {
		
	em.persist(gln);
		
	}

	@Override
	public List<GLN> getAllGLNs() {
		Query req=em.createQuery("select e from GLN e");
		return req.getResultList();
	}

	@Override
	public GLN getGLNe(Integer Id) {
		return em.find(GLN.class, Id);
	}

	@Override
	public void updateGLN(GLN gln) 
	{
		em.merge(gln);
	}

	@Override
	public void deleteGLN(Integer Id) 
	{
	    em.remove(em.find(GLN.class, Id));
	}

	
}
